{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    },
    "widgets": {
      "application/vnd.jupyter.widget-state+json": {
        "4c87325032964335b7d8048f9f5c8ba2": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "TextModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "TextModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "TextView",
            "continuous_update": true,
            "description": "Enter Movie Title:",
            "description_tooltip": null,
            "disabled": false,
            "layout": "IPY_MODEL_d680cd9a7edc4aa49c9cf970b0e8533b",
            "placeholder": "​",
            "style": "IPY_MODEL_506591646b8c4c9aacf1be638414927d",
            "value": "Avatar"
          }
        },
        "d680cd9a7edc4aa49c9cf970b0e8533b": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "506591646b8c4c9aacf1be638414927d": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "d6d069ff1e9442ca9735bebf96179140": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ButtonModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ButtonModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ButtonView",
            "button_style": "",
            "description": "Get Recommendations",
            "disabled": false,
            "icon": "",
            "layout": "IPY_MODEL_0206e691b158444887a3d7e43f764f2f",
            "style": "IPY_MODEL_7b0907f81f8c43c49a31b80c79b9d9a6",
            "tooltip": ""
          }
        },
        "0206e691b158444887a3d7e43f764f2f": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "7b0907f81f8c43c49a31b80c79b9d9a6": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ButtonStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ButtonStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "button_color": null,
            "font_weight": ""
          }
        },
        "3bca3d6fa3144e0fa49985ded2d4d983": {
          "model_module": "@jupyter-widgets/output",
          "model_name": "OutputModel",
          "model_module_version": "1.0.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/output",
            "_model_module_version": "1.0.0",
            "_model_name": "OutputModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/output",
            "_view_module_version": "1.0.0",
            "_view_name": "OutputView",
            "layout": "IPY_MODEL_fa6af8e931f94434aecd7966d2a627f1",
            "msg_id": "",
            "outputs": [
              {
                "output_type": "stream",
                "name": "stdout",
                "text": [
                  "Recommended movies for 'Avatar':\n",
                  "1. #Horror\n",
                  "2. Speed\n",
                  "3. Spice World\n",
                  "4. Sphinx\n",
                  "5. Sphere\n"
                ]
              }
            ]
          }
        },
        "fa6af8e931f94434aecd7966d2a627f1": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        }
      }
    }
  },
  "cells": [
    {
      "cell_type": "code",
      "execution_count": 19,
      "metadata": {
        "id": "KiX5xgvCe8dU"
      },
      "outputs": [],
      "source": [
        "import numpy as np\n",
        "import pandas as pd\n",
        "import ipywidgets as widgets\n",
        "from IPython.display import display, clear_output\n",
        "from sklearn.metrics.pairwise import cosine_similarity"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "data = pd.read_csv('movie_metadata.csv')"
      ],
      "metadata": {
        "id": "9GZQ9zUEg1vH"
      },
      "execution_count": 20,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "data.head()"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 351
        },
        "id": "y9K4oCevhJMg",
        "outputId": "d133f5d2-6d6e-44e2-8e66-9d9a655ccfd1"
      },
      "execution_count": 21,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "   color      director_name  num_critic_for_reviews  duration  \\\n",
              "0  Color      James Cameron                   723.0     178.0   \n",
              "1  Color     Gore Verbinski                   302.0     169.0   \n",
              "2  Color         Sam Mendes                   602.0     148.0   \n",
              "3  Color  Christopher Nolan                   813.0     164.0   \n",
              "4    NaN        Doug Walker                     NaN       NaN   \n",
              "\n",
              "   director_facebook_likes  actor_3_facebook_likes      actor_2_name  \\\n",
              "0                      0.0                   855.0  Joel David Moore   \n",
              "1                    563.0                  1000.0     Orlando Bloom   \n",
              "2                      0.0                   161.0      Rory Kinnear   \n",
              "3                  22000.0                 23000.0    Christian Bale   \n",
              "4                    131.0                     NaN        Rob Walker   \n",
              "\n",
              "   actor_1_facebook_likes        gross                           genres  ...  \\\n",
              "0                  1000.0  760505847.0  Action|Adventure|Fantasy|Sci-Fi  ...   \n",
              "1                 40000.0  309404152.0         Action|Adventure|Fantasy  ...   \n",
              "2                 11000.0  200074175.0        Action|Adventure|Thriller  ...   \n",
              "3                 27000.0  448130642.0                  Action|Thriller  ...   \n",
              "4                   131.0          NaN                      Documentary  ...   \n",
              "\n",
              "  num_user_for_reviews language  country  content_rating       budget  \\\n",
              "0               3054.0  English      USA           PG-13  237000000.0   \n",
              "1               1238.0  English      USA           PG-13  300000000.0   \n",
              "2                994.0  English       UK           PG-13  245000000.0   \n",
              "3               2701.0  English      USA           PG-13  250000000.0   \n",
              "4                  NaN      NaN      NaN             NaN          NaN   \n",
              "\n",
              "   title_year actor_2_facebook_likes imdb_score  aspect_ratio  \\\n",
              "0      2009.0                  936.0        7.9          1.78   \n",
              "1      2007.0                 5000.0        7.1          2.35   \n",
              "2      2015.0                  393.0        6.8          2.35   \n",
              "3      2012.0                23000.0        8.5          2.35   \n",
              "4         NaN                   12.0        7.1           NaN   \n",
              "\n",
              "  movie_facebook_likes  \n",
              "0                33000  \n",
              "1                    0  \n",
              "2                85000  \n",
              "3               164000  \n",
              "4                    0  \n",
              "\n",
              "[5 rows x 28 columns]"
            ],
            "text/html": [
              "\n",
              "\n",
              "  <div id=\"df-3cc7ae03-c968-4b04-96ab-b2e08c4c5a72\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>color</th>\n",
              "      <th>director_name</th>\n",
              "      <th>num_critic_for_reviews</th>\n",
              "      <th>duration</th>\n",
              "      <th>director_facebook_likes</th>\n",
              "      <th>actor_3_facebook_likes</th>\n",
              "      <th>actor_2_name</th>\n",
              "      <th>actor_1_facebook_likes</th>\n",
              "      <th>gross</th>\n",
              "      <th>genres</th>\n",
              "      <th>...</th>\n",
              "      <th>num_user_for_reviews</th>\n",
              "      <th>language</th>\n",
              "      <th>country</th>\n",
              "      <th>content_rating</th>\n",
              "      <th>budget</th>\n",
              "      <th>title_year</th>\n",
              "      <th>actor_2_facebook_likes</th>\n",
              "      <th>imdb_score</th>\n",
              "      <th>aspect_ratio</th>\n",
              "      <th>movie_facebook_likes</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Color</td>\n",
              "      <td>James Cameron</td>\n",
              "      <td>723.0</td>\n",
              "      <td>178.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>855.0</td>\n",
              "      <td>Joel David Moore</td>\n",
              "      <td>1000.0</td>\n",
              "      <td>760505847.0</td>\n",
              "      <td>Action|Adventure|Fantasy|Sci-Fi</td>\n",
              "      <td>...</td>\n",
              "      <td>3054.0</td>\n",
              "      <td>English</td>\n",
              "      <td>USA</td>\n",
              "      <td>PG-13</td>\n",
              "      <td>237000000.0</td>\n",
              "      <td>2009.0</td>\n",
              "      <td>936.0</td>\n",
              "      <td>7.9</td>\n",
              "      <td>1.78</td>\n",
              "      <td>33000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>Color</td>\n",
              "      <td>Gore Verbinski</td>\n",
              "      <td>302.0</td>\n",
              "      <td>169.0</td>\n",
              "      <td>563.0</td>\n",
              "      <td>1000.0</td>\n",
              "      <td>Orlando Bloom</td>\n",
              "      <td>40000.0</td>\n",
              "      <td>309404152.0</td>\n",
              "      <td>Action|Adventure|Fantasy</td>\n",
              "      <td>...</td>\n",
              "      <td>1238.0</td>\n",
              "      <td>English</td>\n",
              "      <td>USA</td>\n",
              "      <td>PG-13</td>\n",
              "      <td>300000000.0</td>\n",
              "      <td>2007.0</td>\n",
              "      <td>5000.0</td>\n",
              "      <td>7.1</td>\n",
              "      <td>2.35</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>Color</td>\n",
              "      <td>Sam Mendes</td>\n",
              "      <td>602.0</td>\n",
              "      <td>148.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>161.0</td>\n",
              "      <td>Rory Kinnear</td>\n",
              "      <td>11000.0</td>\n",
              "      <td>200074175.0</td>\n",
              "      <td>Action|Adventure|Thriller</td>\n",
              "      <td>...</td>\n",
              "      <td>994.0</td>\n",
              "      <td>English</td>\n",
              "      <td>UK</td>\n",
              "      <td>PG-13</td>\n",
              "      <td>245000000.0</td>\n",
              "      <td>2015.0</td>\n",
              "      <td>393.0</td>\n",
              "      <td>6.8</td>\n",
              "      <td>2.35</td>\n",
              "      <td>85000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>Color</td>\n",
              "      <td>Christopher Nolan</td>\n",
              "      <td>813.0</td>\n",
              "      <td>164.0</td>\n",
              "      <td>22000.0</td>\n",
              "      <td>23000.0</td>\n",
              "      <td>Christian Bale</td>\n",
              "      <td>27000.0</td>\n",
              "      <td>448130642.0</td>\n",
              "      <td>Action|Thriller</td>\n",
              "      <td>...</td>\n",
              "      <td>2701.0</td>\n",
              "      <td>English</td>\n",
              "      <td>USA</td>\n",
              "      <td>PG-13</td>\n",
              "      <td>250000000.0</td>\n",
              "      <td>2012.0</td>\n",
              "      <td>23000.0</td>\n",
              "      <td>8.5</td>\n",
              "      <td>2.35</td>\n",
              "      <td>164000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>NaN</td>\n",
              "      <td>Doug Walker</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>131.0</td>\n",
              "      <td>NaN</td>\n",
              "      <td>Rob Walker</td>\n",
              "      <td>131.0</td>\n",
              "      <td>NaN</td>\n",
              "      <td>Documentary</td>\n",
              "      <td>...</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>12.0</td>\n",
              "      <td>7.1</td>\n",
              "      <td>NaN</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>5 rows × 28 columns</p>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-3cc7ae03-c968-4b04-96ab-b2e08c4c5a72')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "\n",
              "\n",
              "\n",
              "    <div id=\"df-8c17af57-902f-4967-896a-e77e077b7722\">\n",
              "      <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-8c17af57-902f-4967-896a-e77e077b7722')\"\n",
              "              title=\"Suggest charts.\"\n",
              "              style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "      </button>\n",
              "    </div>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "    background-color: #E8F0FE;\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: #1967D2;\n",
              "    height: 32px;\n",
              "    padding: 0 0 0 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: #E2EBFA;\n",
              "    box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: #174EA6;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "    background-color: #3B4455;\n",
              "    fill: #D2E3FC;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart:hover {\n",
              "    background-color: #434B5C;\n",
              "    box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "    filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "    fill: #FFFFFF;\n",
              "  }\n",
              "</style>\n",
              "\n",
              "    <script>\n",
              "      async function quickchart(key) {\n",
              "        const containerElement = document.querySelector('#' + key);\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      }\n",
              "    </script>\n",
              "\n",
              "      <script>\n",
              "\n",
              "function displayQuickchartButton(domScope) {\n",
              "  let quickchartButtonEl =\n",
              "    domScope.querySelector('#df-8c17af57-902f-4967-896a-e77e077b7722 button.colab-df-quickchart');\n",
              "  quickchartButtonEl.style.display =\n",
              "    google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "}\n",
              "\n",
              "        displayQuickchartButton(document);\n",
              "      </script>\n",
              "      <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-3cc7ae03-c968-4b04-96ab-b2e08c4c5a72 button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-3cc7ae03-c968-4b04-96ab-b2e08c4c5a72');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 21
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "data[\"movie_title\"][0]"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 36
        },
        "id": "ePx22q-fub3w",
        "outputId": "63ddf59d-7df4-44dc-abb2-2b475df37816"
      },
      "execution_count": 22,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "'Avatar\\xa0'"
            ],
            "application/vnd.google.colaboratory.intrinsic+json": {
              "type": "string"
            }
          },
          "metadata": {},
          "execution_count": 22
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "data.shape"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "dRl3lP3Gg8go",
        "outputId": "c648ef1f-d21f-4330-a827-e7eaf536595c"
      },
      "execution_count": 23,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "(5043, 28)"
            ]
          },
          "metadata": {},
          "execution_count": 23
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "data.dtypes"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "f6Ts-WazhLpw",
        "outputId": "53b61ab7-1c54-4ced-bc5c-e92c1c19e79d"
      },
      "execution_count": 24,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "color                         object\n",
              "director_name                 object\n",
              "num_critic_for_reviews       float64\n",
              "duration                     float64\n",
              "director_facebook_likes      float64\n",
              "actor_3_facebook_likes       float64\n",
              "actor_2_name                  object\n",
              "actor_1_facebook_likes       float64\n",
              "gross                        float64\n",
              "genres                        object\n",
              "actor_1_name                  object\n",
              "movie_title                   object\n",
              "num_voted_users                int64\n",
              "cast_total_facebook_likes      int64\n",
              "actor_3_name                  object\n",
              "facenumber_in_poster         float64\n",
              "plot_keywords                 object\n",
              "movie_imdb_link               object\n",
              "num_user_for_reviews         float64\n",
              "language                      object\n",
              "country                       object\n",
              "content_rating                object\n",
              "budget                       float64\n",
              "title_year                   float64\n",
              "actor_2_facebook_likes       float64\n",
              "imdb_score                   float64\n",
              "aspect_ratio                 float64\n",
              "movie_facebook_likes           int64\n",
              "dtype: object"
            ]
          },
          "metadata": {},
          "execution_count": 24
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "data.columns"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "DZW30M_Zg-NR",
        "outputId": "c6d39b71-a890-4f97-9dd4-12069907bc86"
      },
      "execution_count": 25,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "Index(['color', 'director_name', 'num_critic_for_reviews', 'duration',\n",
              "       'director_facebook_likes', 'actor_3_facebook_likes', 'actor_2_name',\n",
              "       'actor_1_facebook_likes', 'gross', 'genres', 'actor_1_name',\n",
              "       'movie_title', 'num_voted_users', 'cast_total_facebook_likes',\n",
              "       'actor_3_name', 'facenumber_in_poster', 'plot_keywords',\n",
              "       'movie_imdb_link', 'num_user_for_reviews', 'language', 'country',\n",
              "       'content_rating', 'budget', 'title_year', 'actor_2_facebook_likes',\n",
              "       'imdb_score', 'aspect_ratio', 'movie_facebook_likes'],\n",
              "      dtype='object')"
            ]
          },
          "metadata": {},
          "execution_count": 25
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "data.isnull().sum()"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "ASr_QveFhGmB",
        "outputId": "89db373d-61a3-43f2-aaef-82fca20850a8"
      },
      "execution_count": 26,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "color                         19\n",
              "director_name                104\n",
              "num_critic_for_reviews        50\n",
              "duration                      15\n",
              "director_facebook_likes      104\n",
              "actor_3_facebook_likes        23\n",
              "actor_2_name                  13\n",
              "actor_1_facebook_likes         7\n",
              "gross                        884\n",
              "genres                         0\n",
              "actor_1_name                   7\n",
              "movie_title                    0\n",
              "num_voted_users                0\n",
              "cast_total_facebook_likes      0\n",
              "actor_3_name                  23\n",
              "facenumber_in_poster          13\n",
              "plot_keywords                153\n",
              "movie_imdb_link                0\n",
              "num_user_for_reviews          21\n",
              "language                      12\n",
              "country                        5\n",
              "content_rating               303\n",
              "budget                       492\n",
              "title_year                   108\n",
              "actor_2_facebook_likes        13\n",
              "imdb_score                     0\n",
              "aspect_ratio                 329\n",
              "movie_facebook_likes           0\n",
              "dtype: int64"
            ]
          },
          "metadata": {},
          "execution_count": 26
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "data=data.dropna()"
      ],
      "metadata": {
        "id": "qB7iePoVhX8s"
      },
      "execution_count": 27,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "data.isnull().sum()"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "UG_DbbXIhpeg",
        "outputId": "e46f1979-70f6-4355-c2f5-ecf64eb92194"
      },
      "execution_count": 28,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "color                        0\n",
              "director_name                0\n",
              "num_critic_for_reviews       0\n",
              "duration                     0\n",
              "director_facebook_likes      0\n",
              "actor_3_facebook_likes       0\n",
              "actor_2_name                 0\n",
              "actor_1_facebook_likes       0\n",
              "gross                        0\n",
              "genres                       0\n",
              "actor_1_name                 0\n",
              "movie_title                  0\n",
              "num_voted_users              0\n",
              "cast_total_facebook_likes    0\n",
              "actor_3_name                 0\n",
              "facenumber_in_poster         0\n",
              "plot_keywords                0\n",
              "movie_imdb_link              0\n",
              "num_user_for_reviews         0\n",
              "language                     0\n",
              "country                      0\n",
              "content_rating               0\n",
              "budget                       0\n",
              "title_year                   0\n",
              "actor_2_facebook_likes       0\n",
              "imdb_score                   0\n",
              "aspect_ratio                 0\n",
              "movie_facebook_likes         0\n",
              "dtype: int64"
            ]
          },
          "metadata": {},
          "execution_count": 28
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "data.drop_duplicates(subset=None,keep=\"first\",inplace=True)"
      ],
      "metadata": {
        "id": "IjlVvWl0ifQv"
      },
      "execution_count": 29,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "def actors(x):\n",
        "    a = data[['movie_title','imdb_score']][data['actor_1_name'] == x]\n",
        "    b = data[['movie_title','imdb_score']][data['actor_2_name'] == x]\n",
        "    c = data[['movie_title','imdb_score']][data['actor_3_name'] == x]\n",
        "    a = a.append(b)\n",
        "    a = a.append(c)\n",
        "    a = a.sort_values(by = 'imdb_score', ascending = False)\n",
        "    return a.head(15)"
      ],
      "metadata": {
        "id": "XYKlQaCYlFdG"
      },
      "execution_count": 30,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "actors('Christian Bale')"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 609
        },
        "id": "vjA0RKlYlQuK",
        "outputId": "50a11ab9-4d12-47f0-e381-366b12187fbb"
      },
      "execution_count": 31,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "<ipython-input-30-24ab2c06d8d7>:5: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.\n",
            "  a = a.append(b)\n",
            "<ipython-input-30-24ab2c06d8d7>:6: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.\n",
            "  a = a.append(c)\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                 movie_title  imdb_score\n",
              "66          The Dark Knight          9.0\n",
              "3     The Dark Knight Rises          8.5\n",
              "1233           The Prestige          8.5\n",
              "120           Batman Begins          8.3\n",
              "2047   Howl's Moving Castle          8.2\n",
              "3029            The Fighter          7.9\n",
              "1052           3:10 to Yuma          7.8\n",
              "1756          The Big Short          7.8\n",
              "3779          The Machinist          7.7\n",
              "3383        American Psycho          7.6\n",
              "327      The Flowers of War          7.6\n",
              "2329            Equilibrium          7.5\n",
              "3186            Rescue Dawn          7.3\n",
              "1185        American Hustle          7.3\n",
              "2625           Little Women          7.3"
            ],
            "text/html": [
              "\n",
              "\n",
              "  <div id=\"df-16c92753-02c4-414a-875b-cf05e35bc857\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>movie_title</th>\n",
              "      <th>imdb_score</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>66</th>\n",
              "      <td>The Dark Knight</td>\n",
              "      <td>9.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>The Dark Knight Rises</td>\n",
              "      <td>8.5</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1233</th>\n",
              "      <td>The Prestige</td>\n",
              "      <td>8.5</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>120</th>\n",
              "      <td>Batman Begins</td>\n",
              "      <td>8.3</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2047</th>\n",
              "      <td>Howl's Moving Castle</td>\n",
              "      <td>8.2</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3029</th>\n",
              "      <td>The Fighter</td>\n",
              "      <td>7.9</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1052</th>\n",
              "      <td>3:10 to Yuma</td>\n",
              "      <td>7.8</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1756</th>\n",
              "      <td>The Big Short</td>\n",
              "      <td>7.8</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3779</th>\n",
              "      <td>The Machinist</td>\n",
              "      <td>7.7</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3383</th>\n",
              "      <td>American Psycho</td>\n",
              "      <td>7.6</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>327</th>\n",
              "      <td>The Flowers of War</td>\n",
              "      <td>7.6</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2329</th>\n",
              "      <td>Equilibrium</td>\n",
              "      <td>7.5</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3186</th>\n",
              "      <td>Rescue Dawn</td>\n",
              "      <td>7.3</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1185</th>\n",
              "      <td>American Hustle</td>\n",
              "      <td>7.3</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2625</th>\n",
              "      <td>Little Women</td>\n",
              "      <td>7.3</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-16c92753-02c4-414a-875b-cf05e35bc857')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "\n",
              "\n",
              "\n",
              "    <div id=\"df-9837dedd-a1be-4bfb-85f8-9b5fa794983d\">\n",
              "      <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-9837dedd-a1be-4bfb-85f8-9b5fa794983d')\"\n",
              "              title=\"Suggest charts.\"\n",
              "              style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "      </button>\n",
              "    </div>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "    background-color: #E8F0FE;\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: #1967D2;\n",
              "    height: 32px;\n",
              "    padding: 0 0 0 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: #E2EBFA;\n",
              "    box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: #174EA6;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "    background-color: #3B4455;\n",
              "    fill: #D2E3FC;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart:hover {\n",
              "    background-color: #434B5C;\n",
              "    box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "    filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "    fill: #FFFFFF;\n",
              "  }\n",
              "</style>\n",
              "\n",
              "    <script>\n",
              "      async function quickchart(key) {\n",
              "        const containerElement = document.querySelector('#' + key);\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      }\n",
              "    </script>\n",
              "\n",
              "      <script>\n",
              "\n",
              "function displayQuickchartButton(domScope) {\n",
              "  let quickchartButtonEl =\n",
              "    domScope.querySelector('#df-9837dedd-a1be-4bfb-85f8-9b5fa794983d button.colab-df-quickchart');\n",
              "  quickchartButtonEl.style.display =\n",
              "    google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "}\n",
              "\n",
              "        displayQuickchartButton(document);\n",
              "      </script>\n",
              "      <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-16c92753-02c4-414a-875b-cf05e35bc857 button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-16c92753-02c4-414a-875b-cf05e35bc857');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 31
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "data['movie_title'] = data['movie_title'].str.strip()\n",
        "pivot_table = data.pivot_table(index='movie_title', values='imdb_score')\n",
        "movie_similarity = cosine_similarity(pivot_table)\n",
        "similarity_df = pd.DataFrame(movie_similarity, index=pivot_table.index, columns=pivot_table.index)"
      ],
      "metadata": {
        "id": "NxswdDDUwY8p"
      },
      "execution_count": 33,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "def recommend_movies(movie_title, num_recommendations=5):\n",
        "    similar_movies = similarity_df[movie_title].sort_values(ascending=False)\n",
        "    similar_movies = similar_movies.drop(movie_title)  # Exclude the input movie\n",
        "    recommendations = similar_movies.head(num_recommendations).index.tolist()\n",
        "    return recommendations"
      ],
      "metadata": {
        "id": "mRuF_fbK0AHC"
      },
      "execution_count": 34,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "movie_to_recommend = 'Avatar'\n",
        "recommended_movies = recommend_movies(movie_to_recommend)\n",
        "print(f\"Recommended movies for '{movie_to_recommend}':\")\n",
        "for idx, movie in enumerate(recommended_movies, start=1):\n",
        "    print(f\"{idx}. {movie}\")"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "4gLDL1fB0C2d",
        "outputId": "af73bf5d-24a4-44d6-ff44-ff2e5d17bfb9"
      },
      "execution_count": 35,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Recommended movies for 'Avatar':\n",
            "1. #Horror\n",
            "2. Speed\n",
            "3. Spice World\n",
            "4. Sphinx\n",
            "5. Sphere\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "movie_input = widgets.Text(value='Avatar', description='Enter Movie Title:')\n",
        "display(movie_input)\n",
        "\n",
        "\n",
        "def on_button_click(button):\n",
        "    movie_to_recommend = movie_input.value\n",
        "    recommended_movies = recommend_movies(movie_to_recommend)\n",
        "    with output:\n",
        "        clear_output()\n",
        "        print(f\"Recommended movies for '{movie_to_recommend}':\")\n",
        "        for idx, movie in enumerate(recommended_movies, start=1):\n",
        "            print(f\"{idx}. {movie}\")\n",
        "\n",
        "\n",
        "button = widgets.Button(description=\"Get Recommendations\")\n",
        "display(button)\n",
        "button.on_click(on_button_click)\n",
        "output = widgets.Output()\n",
        "display(output)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 185,
          "referenced_widgets": [
            "4c87325032964335b7d8048f9f5c8ba2",
            "d680cd9a7edc4aa49c9cf970b0e8533b",
            "506591646b8c4c9aacf1be638414927d",
            "d6d069ff1e9442ca9735bebf96179140",
            "0206e691b158444887a3d7e43f764f2f",
            "7b0907f81f8c43c49a31b80c79b9d9a6",
            "3bca3d6fa3144e0fa49985ded2d4d983",
            "fa6af8e931f94434aecd7966d2a627f1"
          ]
        },
        "id": "Y39ErlCuyiJ1",
        "outputId": "8b424c3d-4c32-4e5b-842f-17a6f815d665"
      },
      "execution_count": 36,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "Text(value='Avatar', description='Enter Movie Title:')"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "4c87325032964335b7d8048f9f5c8ba2"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "Button(description='Get Recommendations', style=ButtonStyle())"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "d6d069ff1e9442ca9735bebf96179140"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "Output()"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "3bca3d6fa3144e0fa49985ded2d4d983"
            }
          },
          "metadata": {}
        }
      ]
    }
  ]
}